package com.htlwk.javapractice;

import java.util.function.Predicate;

/**
 * @ClassName Predicate01
 * @Description TODO
 * @Author liaowenxiong
 * @Date 2024/12/23 22:49
 * @Version 1.0
 */
public class Predicate01 {
    public static void main(String[] args) {
        String str = "abcefg";
        Predicate<String> p1 = s -> s.length() >5;
        Predicate<String> p2 = s -> s.contains("a");
        boolean b = checkString(str, p1, p2);
        System.out.println(b);
    }
    public static boolean checkString(String str, Predicate<String> p1, Predicate<String> p2) {
        return p1.and(p2).test(str);
    }
}
